package tt.dz.egobus.servicemanager.service.impl;

import org.springframework.stereotype.Service;
import tt.dz.egobus.api.ResponseBack;
import tt.dz.egobus.api.commoncenter.bean.ConfigBack;
import tt.dz.egobus.api.commoncenter.bean.ConfigTypeBack;
import tt.dz.egobus.servicemanager.base.service.AbstractFacadeServiceConfig;
import tt.dz.egobus.servicemanager.facade.common.CommonFacade;
import tt.dz.egobus.servicemanager.facade.interator.FacadeFactory;
import tt.dz.egobus.servicemanager.facade.interator.FacadeFactoryLoggerInterceptorHolder;
import tt.dz.egobus.servicemanager.service.OperationConfigManagerService;

import java.util.List;

/**
 * @author Anson
 * @date 17-8-11
 * @name dubbo实现的运营配置动态管理
 * @since 1.0.6
 */
@Service("dubboOperationConfigManagerServiceImpl")
public class DubboOperationConfigManagerServiceImpl extends AbstractFacadeServiceConfig implements OperationConfigManagerService {

    @Override
    protected FacadeFactory getFacadeFactory() {
        return FacadeFactoryLoggerInterceptorHolder.LOGGER_FACADE;
    }

    private CommonFacade getStaffApiService() {
        return this.facade("common", CommonFacade.class);
    }

    @Override
    public ResponseBack<List<ConfigTypeBack>> getAllConfigTypeBack() {
        return this.getStaffApiService().getAllConfigTypeBackOperation();
    }

    @Override
    public ResponseBack<List<ConfigBack>> getSystemConfig(int code) {
        return this.getStaffApiService().getSystemConfigOperation(code);
    }

    @Override
    public ResponseBack<String> getConfigValue(int code, String key) {
        return this.getStaffApiService().getConfigValueOperation(code, key);
    }

    @Override
    public ResponseBack<ConfigBack> updateConfigValue(int code, String key, String value) {
        return this.getStaffApiService().updateConfigValueOperation(code, key, value);
    }


}
